

struct featvalue
{

	virtual string to_string() = 0;
};

struct featvalue_sym : public featvalue
{
	string s_value;

	featvalue_sym( string s_ = "" ) : s_value( s_ ) { }

	virtual string to_string() { return string("\"") + s_value + string("\""); }
};

struct featvalue_alt : public featvalue
{
	vector< featvalue* > v_values;

	void add_value( featvalue* v_ )
	{
		v_values.push_back( v_ );
	}

	virtual string to_string()
	{
		string s;
		for ( int i = 0; i < v_values.size(); ++i )
		{
			if ( i > 0 ) s = s + " OR ";
			s = s + v_values[ i ]-> to_string();
		}
		return s;
	}
};

struct featstruct : public featvalue
{
	map< string, featvalue* > m_feat;

	void add_member( string k_, featvalue* v_ )
	{
		m_feat[ k_ ] = v_;
	}

	virtual string to_string()
	{
		string s;

		map< string, featvalue* >::const_iterator cit = m_feat.begin();
		while ( m_feat.end() != cit )
		{
			if ( s.length() > 0 )
				s = s + " ";

			s += cit->first;
			s += string(":");
			s += cit->second->to_string();
			cit++;
		}
		
		s = string("[ ") + s + string(" ]");

		return s;
	}
};

struct tf_revision
{
	string s_text;
	featstruct fs;
};

struct sentence
{
	vector< tf_revision > v_tf;
};

struct document
{
	vector< sentence > v_sent;
};

bool read_opencorpora_file( string s_fn, document &doc );